#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <getopt.h>
 
static char *opt_storage = "ab:c::";
static const struct option storage_opts[] = {
	{ "a_long", no_argument, 0, 'a' },
	{ "b_long", required_argument, 0, 'b' },
	{ "c_long", optional_argument, 0, 'c' },
	{ 0, 0, 0, 0},
};
 
int main(int argc, char **argv)
{
	int opt = 0;
 
	while (1) {
		int opt_index = 0;
		opt = getopt_long(argc, argv, opt_storage, storage_opts, &opt_index);
		if (opt == -1)
			break;
 
		switch (opt) {
    		case 'a':
                printf("Input %d parameter is -a=%s\n", optind, optarg);
    			break;
    		case 'b':
    			printf("Input %d parameter is -b=%s\n", optind, optarg);
    			break;
    		case 'c':
    			printf("Input %d parameter is -c=%s\n", optind, optarg);
    			break;
 
    		default:
    			break;
		}
	}
 
	return 0;
}